devfandomcom-20200223-history
Forum:Easy imports
I've noticed when browsing the central technical forums, importArticles is often a source of confusion for those not familiar with javascript. So why can't we make it a little easier? How about a form that allows users to check the scripts they want to import and then they get the importArticles code ready to paste into their Common or global.js? We can provide a list of scripts we have here to choose from and allow outside scripts to be added as well, for instance Monch's chathacks. As a basic example paste the following code into your console: $( '#import-copy' ).append( 'Select scripts from Dev Wiki: Option 1Option 2Option 3Option 4Option 5Option 6 Import an outside script here: Colors/code.js w:User:Monchoman45/chathacks.js importArticles({\n type: \'script\',\n articles: []\n}); ' ); Above you'll see a mock up of what the form might look like. The wikitext links will be fully formed links allowing people to make surethey're importing the correct script. I'd also add a check to make sure the script exists before adding it to the articles array. So, any thoughts? :Sounds good, I suppose. Would this be a separate page that Template:Script Install links to, keeping the current content of the template the same? I'd prefer to keep the current instructions available since JS syntax is fairly obvious. But this would definitely be safer and easier for a lot of people to use. ~Bobogoobo (talk) 03:47, November 11, 2013 (UTC) ::I think a link to it would be a good idea, although it could be done as a popup when clicking a link in Script install instead. :::Using Wikias modal functions would work nicely, for Oasis that is. For Monobook you'd need to get some SASS but it isn't too difficult (especially with Wikias built in functions). A slight suggestion, you could use JS to generate a drop down based on the members of the scripts and css category. This way (as long as pages are categorized) the list will always be up to date with the latest and greatest user scripts. Prinplat [w:c:devOpen Source[]] 17:13, November 11, 2013 (UTC) ::::There are 120 scripts in the category, seems like a dropdown for that would get a bit unwieldy. Maybe split them into multiple dropdowns or something. ~Bobogoobo (talk) 03:11, November 12, 2013 (UTC) :::::I think a multi-column checkbox solution would work nicely, with the script names linking to their script page in a new window so we wouldn't have to dig a description out of every single page. I think a standalone page that reads querystring variables from the URL to auto-check whatever script was on the page that they just came from sounds like it would work nicely. That would also mean we wouldn't need additional CSS to support it or anything. Also, maybe adding a little code inside of a comment that keeps track of everything checked would be a good idea, so people can come back and paste the code into the page to re-check everything when they want to add to their importArticles. — Foodbandlt (talk) 06:59, November 12, 2013 (UTC) ::::::A "remember my choices" button sounds like a great idea. For the checkboxes, perhaps a collapsible section like on Special:Search for the namespaces. Considering how many there are, it's probably best for this to be a separate page rather than a popup or we're going to end up with a lot of scrolling to do in a modal. You can check the last page accessed through document.referrer. :::::::What about scripts that have multiple versions? Prinplat [w:c:devOpen Source[]] 00:55, November 13, 2013 (UTC) ::::::::IMO if you know you need a specific version of a script you should have the knowledge to compile your own importArticles function. This seems like it would best suit most current versions of scripts to keep it simple. — Foodbandlt (talk) 01:47, November 13, 2013 (UTC)